import java.util.Random;
import java.util.Scanner;
public class JavaSE724 {
    public static void main(String[] args) {
        /*if (布尔表达式) {

        }
        if (布尔表达式) {

        } else {

        }
        if (布尔表达式) {

        } else if (布尔表达式) {

        } else {

        }*/
        /*if (true)
            if (true)
                System.out.println("jjj");
        else
                System.out.println("jjjj");*/
        /*switch(表达式) {
            case 常量值1: {
                //语句
                break;
            }
            case 常量值2: {
                //语句
                break;
            }
            default: {
                //语句
                break;
            }
        }*/

       /* switch (1) {
            case 0: {
                System.out.println(0);
                break;
            }
            case 1: {
                System.out.println(1);

            }
            case 2: {
                System.out.println(2);
                break;
            }
            default: {
                System.out.println("default");
                break;
            }
        }*/

       /* switch (2) {
            case 1: {
                System.out.println(1);
            }
            case 0: {
                System.out.println(0);
            }
            default: {
                System.out.println("default");
                break;
            }
            case 2: {
                System.out.println(2);
                break;
            }
        }*/
        /*System.out.println("换行的");
        System.out.print("不换行的");
        String s = "格式化的";
        System.out.printf("s=%s\n",s);*/

        /* Scanner scanner = new Scanner(System.in);
         *//*int num = scanner.nextInt();*//*
        String s = scanner.next();
        System.out.println(s);*/

        //种子为系统的时间，随机数生成器每次运行时生成的随机数不同
        //System.out.println(Math.random());
        /*Random random = new Random(32);
        System.out.println(random.nextInt(100));*/

        //猜数字游戏
        /*Random random = new Random();
        int num = random.nextInt(100);//随机生成一个[0,100)的数字
        //再进行判断，直到猜对
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNextInt()) {
            int temp = scanner.nextInt();
            if (temp == num) {
                System.out.println("恭喜您，猜对了！！");
            } else if (temp > num) {
                System.out.println("抱歉，猜大了");
            } else {
                System.out.println("猜小了");
            }
        }*/
//判断该年龄属于哪一阶段
       /* Scanner scanner = new Scanner(System.in);
        while (scanner.hasNextInt()) {
            int age = scanner.nextInt();
            if (age < 18 || age == 18) {
                System.out.println("少年");
            } else if ((age > 19 || age == 19) && (age < 28 || age == 28)) {
                System.out.println("青年");
            } else if ((age > 29 || age == 29) && (age < 55 || age == 55)) {
                System.out.println("中年");
            } else {
                System.out.println("老年");
            }
        }*/

        //判断一个数字是否为素数
        //素数概念，除了一和自身不能被其他数整除
        /*Scanner scanner = new Scanner(System.in);
        while (scanner.hasNextInt()) {
            int num = scanner.nextInt();
            int count = 0;
            for (int i = 2; i < num; i++) {
                if (num % i == 0) {
                    count = 1;
                    break;
                }
            }
            if (count == 0){
                System.out.println("是素数");
            }else {
                System.out.println("不是素数");
            }
        }*/

        //打印1-100之间的所有素数
        /*int count = 100;
        while (count > 0) {
            int temp = 0;
            for (int i = 2; i < count; i++) {
                if (count % i == 0) {
                    temp = 1;
                    break;
                }
            }
            if (temp == 0) {
                System.out.print(count + "\t");
                count--;
            }else {
                count--;
            }
        }*/

        //输出1000-2000之间的闰年
        //1.能被4整除，但不能被100整除，就是闰年；
        // 2.能被400整除，也是闰年
        /*int count = 0;
        for (int year = 1000; year < 2001; year++) {
            if ((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0)) {
                System.out.print(year + "\t");
                count++;
            }else {
                continue;
            }
        }
        System.out.println(count);*/

        //输出乘法口诀表
        /*for (int i = 1; i < 10; i++) {
            for (int j = 1; j < i + 1; j++) {
                System.out.printf("%d*%d=%d\t",j,i,i*j);
            }
            System.out.println();
        }*/

        //求两个正整数的最大公约数
        /*//这里采用辗转相除法
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()) {
            int a = scanner.nextInt();
            int b = scanner.nextInt();
            while (true) {
                if (a % b == 0) {
                    System.out.println(b + "是最大公约数");
                    break;
                } else {
                    int c = a % b;
                    a = b;
                    b = c;
                }
            }
        }*/


        //求出0-999之间的水仙花数并输出。
        /*for (int i = 1; i < 1000; i++) {
            //判断位数，水仙花是三位的
            if ((i / 100) > 0) {
                int bit = i % 100 % 10;
                int tenBit = i % 100 / 10;
                int hundred = i / 100;
                if ((bit * bit * bit) + (tenBit * tenBit * tenBit) + (hundred * hundred * hundred) == i) {
                    System.out.print(i + "\t");
                }
            } else {
                continue;
            }
        }*/


        //计算分数的值1/1-1/2+1/3-1/4+....-1/100
        //分成奇数偶数分别计算
        /*double sum  = 0;
        double a = 0;
        double b = 0;
        for (int i = 1; i < 100; i += 2) {
            a += 1.0/i;
        }
        for (int j = 2; j < 101; j += 2) {
            b += 1.0/j;
        }
        sum = a - b;
        System.out.println(sum);*/

        //打印X图形
        /*Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNextInt()) { // 注意 while 处理多个 case
            int num = in.nextInt();
            for(int i = 1; i < num + 1; i++) {
                for(int j = 1; j < num + 1; j++) {
                    if((i == j) || (i + j == num + 1)) {
                        System.out.print("*");
                    }else {
                        System.out.print(" ");
                    }
                }
                System.out.println();
            }
        }*/

        //输出一个整数的每一位
        /*Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()) {
            //在这我假设的是最多只允许输入三位情况
            int num = scanner.nextInt();
            if (num /100 > 0) {
                //三位
                int bit = num % 100 % 10;
                int tenBit = num % 100 / 10;
                int hundred = num / 100;
                System.out.print(bit + "\t" + tenBit + "\t" + hundred);
                System.out.println();
            } else if (num / 10 > 0) {
                //两位
                int bit = num % 10;
                int tenBit = num / 10;
                System.out.print(bit + "\t" + tenBit);
                System.out.println();
            }else {
                //个位
                System.out.print(num);
                System.out.println();
            }

        }*/

        //模拟登录，最多输入三次
       /* Scanner scanner = new Scanner(System.in);
        int count = 3;
        String password = "hello";
        while (count > 0) {
            String password1 = scanner.nextLine();
            if (password1.equals(password)) {
                System.out.println("登录成功");
                break;
            } else {
                count --;
            }
        }
        if (count == 0) {
            System.out.print("抱歉，您三次密码均输错，程序将关闭");
        }*/


        //求一个数二进制中1的个数
        /*int num = 18;
        int count = 0;
        while (num != 0) {
            count++;
            num = num & (num - 1);
        }
        System.out.println(count);*/

        //求一个数的二进制形式奇数位序列和偶数位序列
        int num = 7;
        for (int i = 31; i > 0; i -= 2) {
            int temp = num;
            int number = (temp >>> i) & 1;
            System.out.print(number + "\t");
        }
        System.out.println();
        for (int j = 30; j > 0 || j == 0; j -= 2) {
            int temp = num;
            int number = (temp >>> j) & 1;
            System.out.print(number + "\t");
        }
    }
}
